package com.machine.action.component;

import java.util.ArrayList;
import java.util.List;

import javax.annotation.Resource;

import org.springframework.context.annotation.Scope;
import org.springframework.stereotype.Component;

import com.machine.service.user.ComponentServiceDao;
import com.opensymphony.xwork2.ActionSupport;


@Component("deleteComAction")
@Scope(value = "prototype")
public class DeleteComponents extends ActionSupport {

	/**
	 * 
	 */
	private static final long serialVersionUID = 1L;
	private ComponentServiceDao componentServiceDao;
	private List<Integer> componentpartsId = new ArrayList<Integer>();

	public ComponentServiceDao getComponentServiceDao() {
		return componentServiceDao;
	}

	@Resource(name = "componentService")
	public void setComponentServiceDao(ComponentServiceDao componentServiceDao) {
		this.componentServiceDao = componentServiceDao;
	}

	public List<Integer> getComponentpartsId() {
		return componentpartsId;
	}

	public void setComponentpartsId(List<Integer> componentpartsId) {
		System.out.println("set componentpartsId : " + componentpartsId);
		this.componentpartsId = componentpartsId;
	}

	@Override
	public String execute() throws Exception {
		System.out.println("componentpartsId : " + componentpartsId);
		componentServiceDao.deleteByIdList(componentpartsId);
		return SUCCESS;
	}

}
